* {
  &,
  &:before,
  &:after {
    box-sizing: border-box;
  }
}

* {
  scrollbar-width: thin;
  scrollbar-color: $secondary-color $base-bg-color;
}

/* Works on Chrome/Edge/Safari */
*::-webkit-scrollbar {
  width: 12px;
}
*::-webkit-scrollbar-track {
  background: $base-bg-color;
}
*::-webkit-scrollbar-thumb {
  background-color: $secondary-color;
  border-radius: 20px;
  border: 3px solid $base-bg-color;
}

body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  color: $base-font-color;
  background-color: $white-color;
  font-family: $base-font-family;
  line-height: $base-line-height;
}

p,
li,
blockquote {
  font-family: $secondary-font-family;
  font-size: $base-font-size;
  text-rendering: optimizeLegibility;
}

a {
  color: $primary-color;
  text-decoration: none;
  transition: color 150ms ease;
}

.clearfix {
  &:before {
    content: " ";
    display: table;
  }

  &:after {
    content: " ";
    display: table;
    clear: both;
  }

  *zoom: 1;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: $secondary-color;
}

h1 {
  font-size: 1.875rem;
  font-weight: 400;
}
h2 {
  font-size: 1.625rem;
  font-weight: 300;
}
h3 {
  font-size: 1.5rem;
  font-weight: 300;
}
h4 {
  font-size: 1.25rem;
  font-weight: 300;
}
h5,
h6 {
  font-size: 1rem;
  font-weight: 300;
}

img {
  margin: 0;
  max-width: 100%;
}

li > p {
  margin: 0;
  &:last-child {
    margin-bottom: 0.5em;
  }
}

ul {
  padding-left: 2em;
}

code {
  background-color: $base-bg-color;
  font-family: Consolas, $base-font-family;
  font-size: 90%;
  padding: 0 5px;
}

table {
  margin: 20px 0;
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  border: 1px solid #ddd;
  font-size: 14px;
  table-layout: fixed;
  word-wrap: break-all;
  box-shadow: $base-box-shadow;
}

tr {
  &:nth-of-type(2n + 1) {
    background-color: #f9f9f9;
  }
  &:hover {
    background-color: #f5f5f5;
  }
}

td,
th {
  border-bottom: 3px solid #ddd;
  border-right: 1px solid #eee;
  vertical-align: middle;
  padding: 8px;
  text-align: left;
  font-weight: normal;
}

td {
  border-bottom-width: 1px;
}

th {
  font-weight: 700;
  padding-bottom: 10px;
}

blockquote {
  padding: 0.2em 10px;
  margin: 1.5em 0;
  border-left: 0.75em solid $light-gray-color;
  background-color: $base-bg-color;
  quotes: none;
  box-shadow: $base-box-shadow;
}

hr {
  border-top: none;
  border-bottom: 2px solid lighten($light-gray-color, 7%);
  width: 100%;
  margin: $small-spacing 0;
}

.container {
  padding: $base-spacing;
  margin-left: auto;
  margin-right: auto;
  max-width: $screen-max-width;
  font-weight: normal;
}

.link {
  color: $secondary-color;
  padding-bottom: 0.05em;
  border-bottom: 2px solid transparent;

  transiton: border 300ms linear;

  &:hover,
  &:focus,
  &:active {
    border-bottom: 2px solid $secondary-color;
  }
}

.site-header {
  border-bottom: 1px solid lighten($light-gray-color, 5%);
  margin-bottom: $small-spacing;
  width: 100%;

  .site-header-container {
    display: flex;
    margin: auto auto;
    justify-content: space-between;
    align-items: center;
    max-width: $screen-max-width;
    padding: 1.5em;
  }
}

.logo {
  letter-spacing: 0.8px;
  font-size: 20px;
  font-weight: 300;
}

.nav {
  display: flex;
  align-items: center;

  a {
    display: inline-block;
    text-decoration: none;
    margin: 0 0.6em;
    color: $secondary-color;
    border-bottom: 2px solid transparent;

    &:hover {
      border-bottom: 2px solid $secondary-color;
    }
  }
}

.post-item {
  margin-bottom: 0.5em;
  display: block;
  border-bottom: 1px dashed lighten($light-gray-color, 10%);

  a {
    color: $primary-color;
  }

  .article-title {
    display: inline-block;
    width: calc(100% - 110px);
  }

  .date-label {
    //border: 1px solid lighten($light-gray-color, 10%);
    display: inline-block;
    width: 110px;
    padding: 0 0.2em;
    float: right;
  }
}

.post-meta {
  color: $medium-gray-color;
  text-transform: uppercase;
  display: inline-block;
  letter-spacing: 1px;
  font-size: 0.875rem;
  margin-bottom: 0px;
  margin-top: 0;
}

.post-title {
  margin-top: 0;
  margin-bottom: 1em;
}

.post-link,
.post a,
.page a {
  @extend .link;
}

.post {
  @extend .clearfix;
}

.site-footer {
  @extend .clearfix;

  padding: $base-spacing 0;

  a {
    @extend .link;
  }

  small {
    display: block;
    font-size: 0.75rem;
    color: darken($medium-gray-color, 10%);
  }

  .block {
    display: block;
  }
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  padding-top: 30px;
  height: 0;
  overflow: hidden;

  iframe,
  object,
  embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

// This applies from 0px to 600px
@media (max-width: 600px) {
  .date-label {
    float: left !important;
    border: 0 !important;
    margin-left: -2px !important;
    margin-top: 2px;
    margin-right: 1em;
  }

  .post-item {
    border: 1px solid lighten($light-gray-color, 10%);
    padding: 0 0.5em;
    background: lighten($light-gray-color, 15%);
  }

  .article-title {
    border-bottom: none !important;
  }

  .post-link {
    &:hover,
    &:focus,
    &:active {
      border-bottom: 2px solid transparent;
      color: $secondary-color;
    }
  }
}

.sbs-block {
  max-width: $screen-max-width;
  margin: $base-spacing 0;
  .highlight {
    flex-basis: 49%;
    margin: 0.5em 0;
    pre {
      height: 100%;
      code {
        white-space: pre-wrap;
      }
    }
  }
}

@media (min-width: 600px) {
  .sbs-block {
    display: flex;
    justify-content: space-around;
    .highlight {
      margin: 0 0;
    }
  }
}

.card-container {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.card {
  font-family: "Noto Sans";
  display: flex;
  flex-direction: column;
  width: 112px;
  height: 182px;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;

  &.pink {
    .card-header {
      background-color: rgba(255, 133, 156, 0.4);
    }
    .card-body {
      background-color: rgb(255, 133, 156);
    }
  }

  &.purple {
    .card-header {
      background-color: rgba(152, 123, 155, 0.4);
    }
    .card-body {
      background-color: rgb(152, 123, 155);
    }
  }

  &.blue {
    .card-header {
      background-color: rgba(121, 195, 234, 0.4);
    }
    .card-body {
      background-color: rgb(121, 195, 234);
    }
  }


  &.grey {
    .card-header {
      background-color: rgba(137, 139, 145, 0.4);
    }
    .card-body {
      background-color: rgb(137, 139, 145);
    }
  }

  &.tall {
    height: 229px; /* Update the card height for book class */
    
    img {
      height: 147px; /* Update the image height for book class */
    }
  }
}

.card-header {
  text-align: center;
  padding: 4px;
  color: rgba(0, 0, 0, 0.6);
  font-size: 14px;
  font-weight: bold;
}

.card-body {
  flex-grow: 1;
  padding: 6px;
  text-align: center;
  font-size: 14px;
}

.card-body-text {
  font-family: "Noto Sans";
  color: rgba(0, 0, 0, 0.5);
  font-size: 12px;
  font-weight: 600;
}

.card img {
  border-radius: 4px;
  width: 100px;
  height: 100px;
}

.dify-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - 320px);
}

.dify {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 1px solid #ddd;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.07),
    0 4px 8px rgba(0, 0, 0, 0.07), 0 8px 16px rgba(0, 0, 0, 0.07);
}